home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_plotutils.idb / usr / freeware / share / ode / population.ode.z / population.ode
Encoding:
Text File  |  1998-10-28  |  608 b   |  32 lines

  1. # This is an example from population biology (the predator-prey
  2. # equations of Lotka and Volterra).  You may run it by doing:
  3. #
  4. #    ode < population.ode | graph -T X -C
  5. # or alternatively, to get a real-time plot,
  6. #
  7. #    ode < population.ode | graph -T X -C -x 0 10 -y 0 3
  8. #
  9. # The plot shows the population of the prey as a function of time.
  10. # The curve oscillates, because as the prey die out, the predators
  11. # starve.
  12.  
  13. # The differential equations are:
  14. # x' = (A - By) x
  15. # y' = (Cx - D) y
  16. # A,B,C,D > 0
  17.  
  18. x' = (A - B*y) * x
  19. y' = (C*x - D) * y
  20.  
  21. A = 1
  22. B = 1
  23. C = 1
  24. D = 1
  25.  
  26. x = 3
  27. y = 1
  28.  
  29. print t, x
  30. step 0, 10
  31.